Draft
Conversation
…e/scratch into feature/send-mask-as-binary
Diff CoverageDiff: origin/main..HEAD, staged and unstaged changes
Summary
src/preprocessors/router.pyLines 179-191 179 Accepts an X3P scan file and edit parameters (mask, zoom, step sizes),
180 validates the file format, parses it according to the parameters, and
181 creates a vault directory for future outputs. Returns access URLs for the vault.
182 """
! 183 if mask_data is not None:
! 184 if params.mask_parameters is None:
! 185 raise HTTPException(HTTPStatus.UNPROCESSABLE_CONTENT, "Invalid request: missing mask parameters.")
186
! 187 _ = parse_mask_pipeline(
188 raw_data=await mask_data.read(),
189 shape=params.mask_parameters.shape,
190 is_bitpacked=params.mask_parameters.is_bitpacked,
191 )Lines 189-198 189 shape=params.mask_parameters.shape,
190 is_bitpacked=params.mask_parameters.is_bitpacked,
191 )
192
! 193 _ = parse_scan_pipeline(params.scan_file, params.step_size_x, params.step_size_y)
! 194 vault = create_vault(params.tag)
195
196 logger.info(f"Generated files saved to {vault}")
197 return ProcessedDataAccess.generate_urls(vault.access_url) |
Minimum allowed line rate is |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR explores the option of sending masks as binary form data. The
edit-scanendpoint now accepts a pydantic model with edit image parameters as JSON string, and a binary field for the mask data.This made automatically generating Swagger documentation quite a bit harder. For this, the
model_json_schema()method was overriden to include the examples and descriptions fromBaseParametersandMaskParameters, and theopenapi_extrafield was used to inject the generated JSON documentation. To view the examples in the/docsplayground, select eithermultipart/form-dataorapplication/jsonfrom the drop-down menu in theedit-scansection (this is not the default unfortunately).TODO's:
run_pipeline()